/* ************************************************************************
> File Name:     红白蓝彩条排序.cpp
> Author:        程序员lyl
> 微信公众号:    雨特宙
> Created Time:  2024年03月23日 星期六 09时15分58秒
> Description: https://www.nowcoder.com/exam/test/78671826/submission?pid=39932559&pageSource=testHistory 

 ************************************************************************/

#include<iostream>
#include<vector>
using namespace std;

void hbl_sort(vector<int>& hbl){

    int p1=0;
    int p2=hbl.size()-1;
    for(int i = 0; i < p2; i++){

        if(hbl[i]==1){
            swap(hbl[i],hbl[p1]);
            p1++;

        }
        if(hbl[i]==3){

            swap(hbl[i],hbl[p2]);
            p2--;
            i--;
        }
    }
}

int main(){

    vector<int> hbl;
    int v;
    cout << "please input"<<endl;
    while(cin>>v){

        hbl.push_back(v);

    }
// cin >> hbl;
    hbl_sort(hbl);
    for(auto c : hbl)
        cout << c << " ";
    //cout<<hbl<<endl;

    return 0;

}
